//
//  USConnectLib.h
//  viewtest
//
//  Created by xy on 10-2-20.
//  Copyright 2010 HANDPAY. All rights reserved.
//
#include "luaEngine.h"
#import "ZZTongDefine.h"

@protocol NetCallBackDelegate <NSObject>

@optional
-(void) responseCallBackSuccess:(NSString*)action withData:(NSDictionary *)respData;
-(void) responseCallBackFailed:(NSString*)action withErrCode:(NSString*)errCode withErrMsg:(NSString*)msg;
@end

@interface NSNetData : NSOperation{
	NSString * url;     // 请求地址
	NSString * action;  // 请求的action
	NSDictionary * params; // 请求参数
	NSDictionary * header; // 请求头部
    id<NetCallBackDelegate> responseDelegate;     //
    NSString * onlineHostHeader;
    BOOL isDoRSA;  // 是否需要交换密钥
    BOOL isShowAlert;
    BOOL isUploadImg;
}

@property (nonatomic, retain) NSString * url;
@property (nonatomic, retain) NSString * action;
@property (nonatomic, retain) NSDictionary * params;
@property (nonatomic, retain) NSDictionary * header;
@property (nonatomic, assign) id<NetCallBackDelegate> responseDelegate;
@property (nonatomic, retain) NSString * onlineHostHeader;
@property(nonatomic, assign) BOOL isDoRSA;
@property (nonatomic,assign) BOOL isShowAlert;
@property (nonatomic, assign)BOOL isUploadImg;

-(id)initLoad:(NSString*)addrname withparams:(NSDictionary *)paramsi withheaders:(NSDictionary *)headersi withAction:(NSString*)actionnamei withDelegate:(id<NetCallBackDelegate>)delegate withAlert:(BOOL) isShowAlert witUploadImg:(BOOL)uploadImg;

+(id)netDataWithData:(NSNetData*)netData;
@end

@interface NSNetLib : NSObject{
    NSOperationQueue * requsetQueue;
}
@property(nonatomic, retain)NSOperationQueue * requsetQueue;

//-(void)startConnect;
-(void)startRequest:(NSNetData*)requsetData;
+(NSNetLib*)sharedInstance;
+(void)releaseInstance;
//+(void)NetLoad:(NSString *)addrname withAction:(NSString *)action withParams:(NSDictionary *)params withHeaders:(NSDictionary *) headers withFunc:(id<HPResponseCallBackDelegate>)func withAlert:(BOOL)showAlert;

//+(void)sendRequest:(NSString*)action withParams:(NSDictionary*)params withDelegate:(id<NetCallBackDelegate>)delegate;
//+(void)sendRequest:(NSString*)action withParams:(NSDictionary*)params withDelegate:(id<NetCallBackDelegate>)delegate withAddress:(NSString*)addrName;
//+(void)sendRequest:(NSString*)action withParams:(NSDictionary*)params withDelegate:(id<NetCallBackDelegate>)delegate withAlertFlag:(BOOL)isShowAlert;
//+(void)sendRequest:(NSString*)action withParams:(NSDictionary*)params withDelegate:(id<NetCallBackDelegate>)delegate withAddress:(NSString*)addrName withAlertFlag:(BOOL)isShowAlert;

-(void)initCustom;
@end